home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / gpt32src.zip / QMS.TRM < prev    next >
Text File  |  1992-03-25  |  4KB  |  157 lines

  1. /*
  2.  * $Id: qms.trm,v 3.26 92/03/24 22:35:41 woo Exp Locker: woo $
  3.  */
  4.  
  5. /* GNUPLOT - qms.trm */
  6. /*
  7.  * Copyright (C) 1990, 1991, 1992   
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted, 
  11.  * provided that the above copyright notice appear in all copies and 
  12.  * that both that copyright notice and this permission notice appear 
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the modified code.  Modifications are to be distributed 
  17.  * as patches to released version.
  18.  *  
  19.  * This software  is provided "as is" without express or implied warranty.
  20.  * 
  21.  * This file is included by ../term.c.
  22.  *
  23.  * This terminal driver supports:
  24.  *  QMS laser printers
  25.  *
  26.  * AUTHORS
  27.  *  Colin Kelley, Thomas Williams, Russell Lang
  28.  * 
  29.  * send your comments or suggestions to (info-gnuplot@ames.arc.nasa.gov).
  30.  * 
  31.  */
  32.  
  33. #define QMS_XMAX 9000
  34. #define QMS_YMAX 6000
  35.  
  36. #define QMS_XLAST (QMS_XMAX - 1)
  37. #define QMS_YLAST (QMS_YMAX - 1)
  38.  
  39. #define QMS_VCHAR        120
  40. #define QMS_HCHAR        70
  41. #define QMS_VTIC        70
  42. #define QMS_HTIC        70
  43.  
  44. int qms_line = 0;    /* to remember current line type */
  45.  
  46. QMS_init()
  47. {
  48. /* This was just ^IOL, but at Rutgers at least we need some more stuff */
  49.   fprintf(outfile,"^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n");
  50. /*                 ^ QUIC on    ^set defaults  ^ set botttom,top,left margins
  51.                           ^landscape         ^free format   */
  52. /* set defaults are: implicit decimal point, units in inches, 
  53.    numbers left justified, units in 1/1000 inch, do not ignore spaces */
  54. /* margins are in 1/1000 inch units */
  55. }
  56.  
  57.  
  58. QMS_graphics()
  59. {
  60.     fprintf(outfile,"^IGV\n");
  61. /*                     ^enter graphics vector mode */
  62. }
  63.  
  64.  
  65.  
  66. QMS_text()
  67. {
  68. /* added ^-, because ^, after an ^I command doesn't actually print a page */
  69. /* Did anybody try this code out?  [uhh...-cdk] */
  70.     fprintf(outfile,"^IGE\n^-^,");
  71. /*                     ^exit graphics vector mode
  72.                            ^pass terminator
  73.                              ^print page  */
  74. }
  75.  
  76.  
  77. QMS_linetype(linetype)
  78. int linetype;
  79. {
  80. static int width[2+9] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7};
  81. static int type[2+9] =  {0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3};
  82. /*
  83.  * I don't know about Villanova, but on our printer, using ^V without
  84.  * previously setting up a pattern crashes the microcode.
  85.  * [nope, doesn't crash here. -cdk]
  86.  * [it generates a controller error here on dotted lines. - rjl]
  87.  */
  88. /* Code to define patterns added by rjl
  89.  * According to the manual it should work - but it doesn't
  90.  */
  91.     qms_line = linetype;
  92.     if (linetype >= 9)
  93.         linetype %= 9;
  94.     fprintf(outfile,"^PW%02d\n",width[linetype+2]); 
  95. /*                     ^width in dots */
  96.     switch (type[linetype+2]) {
  97.         case 1 :    /* short dash */
  98.             fprintf(outfile,"^PV102025^G\n^V1\n");
  99. /* ^PV = define pattern vector, 1 = pattern number,
  100.    02 = number of pen downs and ups, 025 = .025" length of ups/downs */
  101.             break;
  102.         case 2 :    /* medium dash */
  103.             fprintf(outfile,"^PV202050^G\n^V2\n");
  104.             break;
  105.         case 3 :    /* long dash */
  106.             fprintf(outfile,"^PV302100^G\n^V3\n");
  107.             break;
  108.         default:
  109.         case 0 :
  110.             fprintf(outfile,"^V0\n");
  111.             break;
  112.     }
  113. }
  114.  
  115.  
  116. QMS_move(x,y)
  117. int x,y;
  118. {
  119.     fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
  120. /*                     ^pen up vector*/
  121. }
  122.  
  123.  
  124. QMS_vector(x2,y2)
  125. int x2,y2;
  126. {
  127.     fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
  128. /*                     ^pen down vector*/
  129. }
  130.  
  131.  
  132. QMS_put_text(x,y,str)
  133. unsigned int x,y;
  134. char str[];
  135. {
  136. char ch;
  137.     QMS_move(x,y + QMS_VCHAR/3);
  138.     fputs("^IGE\n",outfile);
  139.     ch = *str++;
  140.     while(ch!='\0') {
  141.         if (ch=='^')
  142.             putc('^',outfile);
  143.         putc(ch,outfile);
  144.         ch = *str++;
  145.     }
  146.     fputs("\n^IGV\n",outfile);
  147.     QMS_linetype(qms_line); /* restore line type */
  148. }
  149.  
  150.  
  151. QMS_reset()
  152. {
  153.     fprintf(outfile,"^PN^-\n");
  154. /*                     ^QUIC off*/
  155. }
  156.  
  157.